home *** CD-ROM | disk | FTP | other *** search
/ Aminet 33 / Aminet 33 - October 1999.iso / Aminet / dev / c / GAPLib.lha / GAPLib / gaplib / Magic.c < prev    next >
Encoding:
C/C++ Source or Header  |  1999-07-04  |  940 b   |  14 lines

  1.  
  2. #include <stdlib.h>
  3. #include <GAP.h>
  4. IPTR l5T(struct Population *,unsigned long int);void n9N(struct Population *,IPTR,unsigned long int);
  5. void f9P(struct Population *,IPTR,unsigned long int);void y8E(struct Population *);
  6. struct Magic {struct Magic *Next;unsigned long int id;IPTR Magic;};IPTR l5T(struct Population *t1La,unsigned long int id)
  7. {struct Magic *M;M = t1La->Magic;while(M!=0 && M->id!=id) {M = M->Next;}if(M!=0) {
  8. return(M->Magic);}return(0L);}void n9N(struct Population *t1La,IPTR b1R,unsigned long int id)
  9. {struct Magic *M;M = malloc(sizeof(struct Magic));M->Next = t1La->Magic;t1La->Magic = M;
  10. M->id = id;M->Magic = b1R;}void f9P(struct Population *t1La,IPTR b1R,unsigned long int id)
  11. {struct Magic *M;M = t1La->Magic;while(M!=0 && M->id!=id) {M = M->Next;}if(M!=0) {
  12. M->Magic = b1R;} else {n9N(t1La,b1R,id);}}void y8E(struct Population *t1La)
  13. {struct Magic *M,*N;M = t1La->Magic;while(M!=0) {N = M->Next;free(M);M = N;
  14. }}